package com.yzh.homework.homework03;

/**
 * @author 于振晗
 * @title: Person
 * @description: TODO 人类
 * @date 2020年08月26日
 * @path com.yzh.homework.homework
 */
public class Person {
//    姓名，年龄，性别
    private String name;
    private int age;
    private String sex;

    public Person(String name, int age, String sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
    }

    public Person() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public void introduce(){
        System.out.println("大家好，我是"+getName());
        System.out.println("今年"+getAge());
    }
}

//运动员
class Athlete extends Person{
    private String project;
    private String score;

    public Athlete(String name, int age, String sex, String project, String score) {
        super(name, age, sex);
        this.project = project;
        this.score = score;
    }

    @Override
    public void introduce() {
        super.introduce();
        System.out.println("我擅长的项目是"+this.project);
        System.out.println("历史最好成绩是"+this.score);
    }
}


//演员
class Actor extends Person{
    private String school;
    private String book;


    public Actor(String name, int age, String sex, String school, String book) {
        super(name, age, sex);
        this.school = school;
        this.book = book;
    }

    @Override
    public void introduce() {
        super.introduce();
        System.out.println("我擅长的项目是"+this.school);
        System.out.println("代表作是《"+this.book+"》");
    }
}

class Test{
    public static void main(String[] args) {
        Athlete athlete = new Athlete("刘晓翔", 23, "男", "200米短跑", "22秒30");
        athlete.introduce();
        System.out.println("==============================");
        Actor actor = new Actor("章依", 20, "女", "北京电影学院", "寄望天国的家书");
        actor.introduce();
    }
}

